package com.kui.web;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.kui.entity.Wenxian;
import com.kui.service.WenxianService;

public class WenxianDetailServlet extends HttpServlet {

	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
			String wid = request.getParameter("wid");
			
			if(wid == null || "".equals(wid)){
				response.sendRedirect("main.jspx");
			}else{
				WenxianService ws = new WenxianService();
				Wenxian w = ws.findById(wid);
				if(w == null){
					response.sendRedirect("main.jspx");
				}else{
					request.setAttribute("wenxian", w);
					request.getRequestDispatcher("WEB-INF/views/wxdetail.jsp").forward(request, response);
				}
			}
		
	}

}
